LotusScript Doc

LotusScript library: LSALibFct

Options
Declare
Public

Uses
LSALibMsgH

Global variables
Private ThisMsg = LSAMessage
Private PatternS List = Pattern
Private PatternSUb = Integer

Types
Public Pattern

Provides a set of basic functions similar to functions available in @Language. Examples are VLeft, VImplode VTrim or alike. These start with V as they are designed to take variants as a parameter which may be both strings and arrays. They also use EMPTY as input or in some cases as return value rather than "". For example VTrim returns an EMPTY if there is no non space element in the input.
Requires the messagehandler LSALibMsgH.

Author:
LPS EMEA
Version:
2.0.1, 06JUN.2000
History:
29.MAR.2000EScReworked for docu standards
02.MAY.2000EScParse CGI case insensitive and handles %20 as blank.
02.MAY.2000EScadded VEqual a routine to compare arrays on equality.
06.JUN.2000EScset necessary auxilaty routines and variables to private.
19.JUL.2000EScerrprepare text fkt->fct, hint >nl> in vexpand docu


Method Summary
Function CNames (InputNames As Variant, NameType As String) As String
Function Empty () As Variant
Function GetNameTypes () As Variant
Function parseCGI (what As String, doc As Variant) As String
Function Vappend (array As Variant, AppendArray As Variant) As Variant
Function Vdate (argument As Variant) As Variant
Function VDelimiters (delChars As String) As Variant
Function VExpand (Mastertext As String, Replacements As Variant) As String
Function VExpandOpt (Mastertext As String, Replacements As Variant, opt As String) As String
Function VExpandPlaceholder (arg As String, Replacements As Variant, Terminates As String, opt As Integer) As Variant
Function VExpandText (Arg As String, Replacements As Variant, Skip As Integer, Cond As Integer, Opt As Integer) As String
Function VExplode (Arg As Variant, Delimiter As Variant) As Variant
Function VFormulaStr (Array As Variant) As Variant
Function VImplode (Arg As Variant, Delimiter As Variant) As String
Function VLeft (Array As Variant, Delim As Variant) As Variant
Function VLeftBack (Array As Variant, Delim As Variant) As Variant
Function VMatchesPattern (CheckStr As String, Byval PatternSIx As Integer) As Integer
Function VNames (InputNames As Variant) As String
Function VRight (Array As Variant, Delim As Variant) As Variant
Function VRightback (Array As Variant, Delim As Variant) As Variant
Function VScriptStr (Array As Variant) As Variant
Function VSort (Arg As Variant) As Variant
Function Vtrim (array As Variant) As Variant
Function VTwinSort (Argument As Variant, TwinArgument As Variant) As Variant
Function VUnique (array As Variant) As Variant

Method Detail

VExplode

Public Function VExplode(Arg As Variant,Delimiter As Variant) As Variant
Splits the Args into items with regard to the delimiters. Datatypes are preserved. Single values are always returned as an one element array.
Example
"abc,def;ghi":"jkl;mno" and ",":";" as delimiters would result in the five element array "abc":"def":"ghi":"jkl":"mno"

Parameters:
ArgVariantarray or single value of type string, number, date or EMPTY
DelimiterVariantarray of strings used toseparate the items.
Returns:
Variantthe resulting array of splitted items
See also:
LSALibFct#Vimplode
LSALibFct#VDelimiters
History:
02.SEP.1996ESc
Summmary Top

VImplode

Public Function VImplode(Arg As Variant,Delimiter As Variant) As String
Glues the items in Arg into a string, in which the items are separated by delimiters. If delimiter is an array it will use the first element of the delimiters.
Example
"abc":"def":"ghi":"jkl":"mno" and";" as delimiters would result in the string "abc;def;ghi;jkl;mno"

Parameters:
ArgVariantarray or single value of type string, number, date or EMPTY
DelimiterVariantcontaining a string used to separate the items.
Returns:
Variantthe resulting array of joined, delimited items
See also:
LSALibFct#VExplode
History:
08.NOV.1996ESc
Summmary Top

VDelimiters

Public Function VDelimiters(delChars As String) As Variant
Creates an array of delimiters from the characters in delChars. If the character is If both FF and LF are used, specify FF first in order to proces the empty lines first.

Parameters:
delCharsStringused to create the array of separator.
Returns:
Variantthe resulting array of splitted items
See also:
LSALibFct#VExplode
History:
02.Sep.1996ESc
Summmary Top

VSort

Public Function VSort(Arg As Variant) As Variant
Sorts the items in the Arg. These items may be of any type that can be compared.
The algorithm curently is a simple bubble sort and is stabile and fastest on sorted arrays

Parameters:
ArgVariantthe array of items to be sorted or EMPTY
Returns:
Variantthe sorted array.
History:
25.APR.1997ESc
Summmary Top

VTwinSort

Public Function VTwinSort(Argument As Variant,TwinArgument As Variant) As Variant
Sorts the items in the TwinArgument based upon the corresponding values in the Argument.The items in Argument may be of any type that can be compared. Both Arrays need to have the same number of elements except when the TwinArgument is EMPTY. Given the TwinArgument is EMPTY we return the sorted indices.
The algorithm currently is a simple bubble sort is stabile and fastest on sorted Arrrays

Parameters:
ArgumentVariantthe Arrray of sortkeys Or EMPTY
TwinArgumentVariantthe Arrray of items to be sorted
Returns:
Variantthe sorted output.
Errors:
ErrArgDimMismatchif Arguments have unequal dimensions
History:
13.JAN.1998ESc
Summmary Top

VExpandPlaceholder

Private Function VExpandPlaceholder(arg As String,Replacements As Variant,Terminates As String,opt As Integer) As Variant
Summmary Top

VExpandText

Private Function VExpandText(Arg As String,Replacements As Variant,Skip As Integer,Cond As Integer,Opt As Integer) As String
Summmary Top

VExpandOpt

Public Function VExpandOpt(Mastertext As String,Replacements As Variant,opt As String) As String
This routine is a Generalization of the VExpand, which allows to specify the behaviour in case of invalid placeholders. Interprets the mastertext and replaces the Placeholders with th ereplacements provided. The mastertext specification follows an easy syntax notation including conditions that are handeled recursively.The syntax is formally described in the VExpand command.
The function is based on the auxilary routine VExpandText.

Parameters:
MastertextStringthe definition of the format
ReplacementsVariantmay be an array of values, a list of values, a notesDocument instance, or even an instance of an OCard generated class, that provides GetAttribByName.
Optstringspecification of the behaviour in case of missing replacements See above
Returns:
Stringthe expanded mastertext.
Errors:
ErrIncompleteConditionif the mastertext can't be interpreted more errors see VExpandText
See also:
LSALibFct#VExpand
History:
21.JUN.1998ESc
Summmary Top

VExpand

Public Function VExpand(Mastertext As String,Replacements As Variant) As String
Interprets the mastertext and replaces the Placeholders with the replacements provided. The mastertext specification follows an easy syntax notation including conditions that are handeled recursively. It uses the default error handling in case of undefined placeholders.
This makes it easy to specify the different formats e.g an addresslabel, of a phone number or alike.
The syntax is formally described below using the following notational convention
{mastertext}={expression} [ {mastertext} ]
{expression}= {text} | "<"{placeholder} [ ";" {format} ]">" | "<"{basicplace}">" | "["{condition}"]"
{text}= "" or any character except ";" or "[" or "]" or {op}
{op}= ">" | "<" | "=" | "><" | "<>"
{placeholder}= {ix} | {Id} | {attrib}
{basicplace}= "[" | "]" | "SC" | "LF" | "EQ" | "GR" | "LE" | "NE" | "HT" | "NL"
GR we return >
LE we return <
EQ we return =
NE we return <>
SC we return ;
HT we return Horizontal tabulator (Char 9 )
LF we return Line feed (Char 10 ) for use in Dialogs!
NL we return Line feed (Char 0 )
[ or ] we return the corresponding character
{ix} is a number, we return the corresponding array-element of the Replacements,
{Id} is a String, we return the corresponding list-element of the Replacements. If the name is EMPTY we return "". Leading and trailing spaces are ignored.
{attrib} an Instance of a business object we return the coresponding field value.If the name is EMPTY we return "". Leading and trailing spaces are ignored. If there is no replacement specification is given, we return the attribname itself.
{Format} = {integer} | {fmt}
{fmt} any Lotus script format like > for uppercase, Percent see Lotus Script function Format[$] ( expr [ , fmt ] )
{integer} any positive or negative number which chunks the number into character portions as given by the integer e.g 1234567890 and format 3 results in 123 456 789 0 while -4 results in 12 3456 7890
{condition} = {operand} [ {Op} {operand} ] ";" {truecase} [";" {falsecase} ]
if the second operand is omitted, we test that the first operand in not EMPTY
{truecase} = {mastertext}
{falsecase}= {mastertext}
{operand} = {placeholder} | text

Example:
Given <PCountry> is 49, <PArea> is 211, <PLine> is 51896, <PExtension> is 99, and the mastertext is
[<PCountry>;+<PCountry> -][<PArea>; (0) <PArea;3> - ]<PLine;3>[<PExtension>; - <PExtension;3>]
the expanded phonenumber would be
+49 (0) 211 - 518 96 - 99

HINT:
Lotus Script interprets the character as a string end. You must not use in a mastertext if this is further modified in Lotus Script.

Parameters:
MastertextStringthe definition of the format
ReplacementsVariantmay be an array of values, a list of values, a notesDocument instance, or even an instance of an OCard generated class, that provides GetAttribByName.
Returns:
Stringthe expanded mastertext.
Errors:
ErrIncompleteConditionThe mastertext can't be fully interpreted, usually a nesting issue
ErrCharAfterCondA condition is not terminated correctly
ErrCharInPlaceholderA placeholder is not terminated correctly
ErrListItemDoesNotExistA placeholder dies not exist
ErrCharAfterOperator1The operator is invalid
ErrCharAfterOperator2The operator is invalid
ErrCharInTrueA true case is not terminated correctly
ErrCharInFalseA false case is not terminated correctly
See also:
LSALibFct#VExpandOpt
History:
21.JUN.1998ESc
Summmary Top

Vappend

Public Function Vappend(array As Variant,AppendArray As Variant) As Variant
Appends the items of the array and the AppendArray into an combined array. If one of the arguments is EMPTY it is ignored, that does not mean that empy elements are ignored. The Items can be any type such as string, integer or others. If the parameter is an individual element , e.g a string, it is treated as an array with one element only.

Parameters:
ArrayVariantmay be EMPTY, an item or an array of items of any type
AppendArrayVariantmay be EMPTY, an item or an array of items of any type
Returns:
Variantthe items concatenated into an array or EMPTY
History:
06.APR.1998ESc
Summmary Top

VUnique

Public Function VUnique(array As Variant) As Variant
Deletes all duplicates from the input array. The input may be EMPTY, an item or an array of items of any type as long as the can be compared.

Parameters:
ArrayVariantEMPTY, an item or an array of items of any type
Returns:
VariantEMPTY or the resulting array of unique elements
History:
22.FEB.1997ESc
Summmary Top

Vtrim

Public Function Vtrim(array As Variant) As Variant
Trims all items and deletes all EMPTY items from the input array. The input may be EMPTY, an item or an array of items of type string.

Parameters:
ArrayVariantEMPTY, an item or an array of items of type string
Returns:
VariantEMPTY or the resulting array of trimmed elements
History:
25.APR.1997ESc
Summmary Top

Vdate

Public Function Vdate(argument As Variant) As Variant
Validates any argument that can be a date and returns a valid Lotus Script datetime. Argument can be any of the following Vdate combines the conversion of both NotesDateTime and Script DatTime into one flexible routine

Parameters:
argumentVariantanything that can be interpreted as a date/time
Returns:
Varianta valid Lotus Script DateTime
Errors:
TypeMissmatchThe input argument can't be interpreted as a valid date
History:
08.NOV.1996ESc
Summmary Top

Empty

Public Function Empty As Variant
Creates the value EMPTY, which is missing from the constants in Lotus Script.

Returns:
Variantwith the value EMPTY
History:
25.APR.1997ESc
Summmary Top

GetNameTypes

Public Function GetNameTypes As Variant
Provides you with an array with the valid name types as expected by CNAMES. Usually the first element"ABBREVIATE" is used as a default value. The list includes both the NameTypes as used by the @Names function as well as the Lotus Script class NotesName.

Returns:
Variantarray with the various Name formats
See also:
LSALibFct#CNames
History:
30.SEP.1996ESc...
Summmary Top

VNames

Public Function VNames(InputNames As Variant) As String
Validates a name and convertsit via the NotesName Object in Lotus Script into a canonicalized string.

Parameters:
InputVariant
Returns:
Varianta string in a canonicalized form
Errors:
ErrVNamesNothingEnteredNothing entered
ErrTypeMismatchif the string is not CANONICALIZABLE (contains no backslashes), an Error is generated
History:
20.FEB.1997ESc
Summmary Top

CNames

Public Function CNames(InputNames As Variant,NameType As String) As String
Converts a proper name in inputNames into a string according to the NameType given as a second parameter. NameTypes are those provided by CNames but also those used by the @Names function, which differs from the property names of the NotesName object.
HINT:
There are NameTypes, that do not return results as expected like Surname, PRMD, ... Example
InputName "Martin Musteman/MyComp/DE" and NameType be "abbreviated" results in
"Martin Musterman/MyComp/DE"

Parameters:
InputNamesVariantthe
InputTypeStringthe format code like "CN", "Abbreviate" etc.
Returns:
Stringa new object of class x
See also:
LSALibFct#GetNameTypes
History:
03.APR.1997EScInserted header
Summmary Top

VLeft

Public Function VLeft(Array As Variant,Delim As Variant) As Variant
Returns for each item in an array of strings the portion left of the first occurence of delimiter from left to right. If the delimiter is a number the begin of the string with this length is returned. The function is similar to @Left. If the delimiter is not contained in the array , the result is an empty string. Should the delimiter be an array, the first element is worked with.

Parameters:
ArrayVariantthe items to be processed
DelimVariantthe delimiter to be searched for
Returns:
Variantarray of the left portions of the items in Array
History:
22.DEC.1998ESc
Summmary Top

VRight

Public Function VRight(Array As Variant,Delim As Variant) As Variant
Returns for each item in an array of strings the portion right of the first occurence ofdelimiter from left to right. If the delimiter is a number the portion right of a begin with this length is returned. The function is similar to @Right. If the delimiter is not contained in the array, the result is an empty string. Should the delimiter be an array, the first element is worked with.

Parameters:
ArrayVariantthe items to be processed
DelimVariantthe delimiter to be searched for
Returns:
Variantarray of the right portions of the items in Array
History:
02.OCT.1998ESc
Summmary Top

VLeftBack

Public Function VLeftBack(Array As Variant,Delim As Variant) As Variant
Returns for each item in an array of strings the portion left of the last occurence of delimiter from left to right. If the delimiter is a number a portion left of a remaining end of this length is returned. The function is similar to @LeftBack. If the delimiter is not contained in the array, the result is an EMPTY string. Should the delimiter be an array, the first element is worked with.

Parameters:
ArrayVariantthe items to be processed
DelimVariantthe delimiter to be searched for
Returns:
Variantarray of the left portions of the items in Array
History:
02.OCT.1998ESc
Summmary Top

VRightback

Public Function VRightback(Array As Variant,Delim As Variant) As Variant
Returns for each item in an array of strings the portion right of the last occurence of delimiter from left to right. If the delimiter is a number the right end of teh string this length is returned. The function is similar to @RightBack. If the delimiter is not contained in the array, the result is an EMPTY string. Should the delimiter be an array, the first element is worked with.

Parameters:
ArrayVariantthe items to be processed
DelimVariantthe delimiter to be searched for
Returns:
Variantarray of the right portions of the items in Array
History:
02.OCT.1998ESc
Summmary Top

VFormulaStr

Public Function VFormulaStr(Array As Variant) As Variant
Escapes a string or each item of an Array with the sequences needed for @formulas

Parameters:
ArrayVariantthe items to be processed
Returns:
Variantarray of the masked items in Array
History:
08.JAN.1998ESc
Summmary Top

VScriptStr

Public Function VScriptStr(Array As Variant) As Variant
Escapes a string or each item of an Array with the sequences needed for Strings in Lotus Script

Parameters:
ArrayVariantthe items to be processed
Returns:
Variantarray of the masked items in Array
History:
09.JUN.1998ESc
Summmary Top

parseCGI

Public Function parseCGI(what As String,doc As Variant) As String
This function takes a key and doc as parameters, and return the value that represented by that key. The doc is the sessions document context, which is an in Memory document containing th einformation as provided with the call of the agent.
Example
Let query_string be key=val & Anotherkey= another%20val & . . .) . Ask for "key" the result will be "val" while asking for "Anotherkey" will result in "another val".

Parameters:
WhatStringdenoting the value to retrieve
DocVariantwhich is a NotesDocument Context
Returns:
Stringvalue as asked for.
History:
03.APR.2000EScInserted header
02.MAY.2000EScCompare the Value Name case and pitch insensitively! Handles %20 as blank as well as all hexadecimals preceded by %
Summmary Top

VMatchesPattern

Private Function VMatchesPattern(CheckStr As String,Byval PatternSIx As Integer) As Integer
Summmary Top

TopLotusScript Doc
© Lotus Professional Services
generated on : 05-Apr-01 10:01:43 AM